package com.example.springboot.controller;

import com.example.springboot.common.Result;
import com.example.springboot.entity.DrugClassification;
import com.example.springboot.entity.Order;
import com.example.springboot.service.OrderService;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    OrderService orderService;

    /*
     * 分页查询
     * @param pageNum:当前页码
     * @param pageSize:每页显示条数
     */
    @GetMapping("/selectPage")
    public Result selectPage(@RequestParam(defaultValue = "1") Integer pageNum,
                                               @RequestParam(defaultValue = "10") Integer pageSize,
                                               Order order){
        PageInfo<Order> orderPageInfo = orderService.selectPage(pageNum, pageSize, order);
        return Result.success(orderPageInfo);
    }

}
